Closed Bug 1964089 Opened 1 month ago Closed 27 days ago

CSS Highlight API: Enable on all channels

Categories

(Core :: CSS Parsing and Computation, task)

task

Tracking

()

RESOLVED FIXED
140 Branch
Tracking Status
relnote-firefox --- ?
firefox140 --- fixed

People

(Reporter: jjaschke, Assigned: jjaschke)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-needed)

Attachments

(1 file)

While not being fully feature-complete (text-decoration and text-shadow are missing), CSS Highlight API can in its current state already be enabled on all channels.

Release Note Request (optional, but appreciated)
[Why is this notable]: Allows web developers to style ranges.
[Affects Firefox for Android]: yes
[Suggested wording]: Added support for the Custom Highlight API, which allows to style text ranges.
[Links (documentation, blog post, etc)]: https://developer.mozilla.org/en-US/docs/Web/API/CSS_Custom_Highlight_API

relnote-firefox: --- → ?
Keywords: dev-doc-needed
Status: NEW → RESOLVED
Closed: 27 days ago
Resolution: --- → FIXED
Target Milestone: --- → 140 Branch

Thanks, added to the Fx140 nightly release notes, please allow 30 minutes for the site to update.
Keeping the relnote-firefox flag as ? to keep it on the radar for inclusion in the final Fx140 release notes.

The priority property does not seem to be respected on CSS Highlight API
https://developer.mozilla.org/en-US/docs/Web/API/Highlight/priority

I have tested in:

  • Chrome 136 - works as expected
  • Safari 18.5 - works as expected
  • Firefox Beta 140 - only respects the last highlight created
  • Firefox Nightly 141 - only respects the last highlight created

This is my test CodePen - https://codepen.io/CodeRedDigital/pen/QwbbqoG?editors=1010

Flags: needinfo?(jjaschke)

Hi Dave, thanks for your report. Let's move this to Bug 1968981.

Flags: needinfo?(jjaschke)

The .add method of the CSS Highlight API can not be chained.
I have tried the following in the console:

const highlight = new Highlight();

const range1 = new Range();
const range2 = new Range();

highlight.add(range1).add(range2);

console.log(highlight.size); // 2

I have tested in:

  • Chrome 136 - works as expected
  • Safari 18.5 - works as expected
  • Firefox Beta 140 - does not work
  • Firefox Nightly 141 - does not work

Adding separately does work:

const highlight = new Highlight();

const range1 = new Range();
const range2 = new Range();

highlight.add(range1);
highlight.add(range2);

console.log(highlight.size); // 2
Flags: needinfo?(jjaschke)

Please file separate issues for this and needinfo me on them, please. I've filed Bug 1969004.

(Really appreciate your efforts though, thank you!)

Flags: needinfo?(jjaschke)

(In reply to Jan Jaeschke [:jjaschke] from comment #9)

Please file separate issues for this and needinfo me on them, please. I've filed Bug 1969004.

(Really appreciate your efforts though, thank you!)

Understood, thank you

QA Whiteboard: [qa-triage-done-c141/b140]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: